package com.x.chalk.controller;


import com.x.chalk.service.intf.UsefulNewsService;
import com.x.chalk.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/api/usefulnews/")
@Api(tags = "干货")
@CrossOrigin
public class UsefulNewsController {
    @Autowired
    private UsefulNewsService service;
    /**查询*/
    @GetMapping("page.do")
    public R page(@ApiParam(value = "页数") int page,@ApiParam(value = "一页几个") int size){
        return service.queryPage(page, size);
    }

    /**
     * 点击进入后查看详情
     * @param id
     * @return
     */
    @GetMapping("detail.do")
    public R detail(@ApiParam(value = "阅读的文章")Integer id){
        return service.queryDetail(id);
    }
    /**
     * 新增阅读数量*/
    @GetMapping("addread.do")
    public R addRead(@ApiParam(value = "阅读的文章")Integer id){
        return service.updateRead(id);
    }
}

